{extend name="mainadmin@layouts/base" /}
{block name="main" }

<header class="header  b-b clearfix">
  <form id="forms" class="talbe-search form-inline "  method="post" action="{:url('getList')}" >
    <div class="page-breadcrumbs">
      <ul class="breadcrumb" >
        <li>
          <i class="fa fa-ellipsis-v"></i>
          <strong>升级审核</strong>
        </li>
      </ul>
      <input type="text" class="form-control input-medium" value="{$search.keyword}" name="keyword" placeholder="会员ID/手机号" data-rule-required="true" />

      <select name="status"  style="width: 130px;" data-toggle="select2"  data-notsearch="true"  data-chang="submit">
        <option value="">升级方式</option>
        <option value="1" >业绩</option>
        <option value="2" >保证金</option>
      </select>

      <select name="status"  style="width: 130px;" data-toggle="select2"  data-notsearch="true"  data-chang="submit">
        <option value="">审核状态</option>
        <option value="0" >待审核</option>
        <option value="1" >审核通过</option>
        <option value="2" >审核拒绝</option>
      </select>

      <button class="btn btn-sm btn-default-iq" type="submit" title="搜索"><i class="fa fa-search"></i></button>
    </div>
  </form>
</header>
<section class="scrollable wrapper w-f ">
  <section class="panel panel-default ">
    <div class="table-responsive " id="list_box">
      {include file="sys_admin/upgradelog/list" /}
    </div>
  </section>
</section>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="z-index: 1060">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" style="text-align: center" id="myModalLabel">审核</h4>
      </div>
      <div class="modal-body" id="label_list">

        <div class="form-group">
          <div class="fl" style="margin-left: 100px;margin-top:-10px;">
            <label class="radio fl">
              <input type="radio" name="status" value="1" checked onclick="changeStatusValue(1)">通过
            </label>
          </div>
          <div style="margin-left: 200px">
            <label class="radio">
              <input type="radio" name="status" value="2" onclick="changeStatusValue(2)">拒绝
            </label>
          </div>
        </div>
        <div class="form-group" style="display: none" id="reasons_pass">
          <input type="text" class="form-control" name="reasons_pass" placeholder="不通过理由">
        </div>
        <input type="hidden" id="upgradelog_id" value="">
      </div>
      <div class="modal-footer" style="text-align: center">
        <button type="button" class="btn btn-default"  data-dismiss="modal">取消</button>
        <button type="button" id="btn_submit" class="btn btn-primary">确定</button>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript">

  $(document).on('click','.operatbtn',function(){
    $('#operating').val($(this).data('type'));
    $('.postBtn').click();
  })

  // 选择数据审核
  function examine(id) {
    $("#myModalLabel").text("审核");
    $("#reasons_pass").hide();
    $('#myModal').modal();
    $("#upgradelog_id").val(id);
    $(":radio[name='status'][value='1']").prop("checked", "checked");
  }

  // 审核信息上传
  $("#btn_submit").click(function(){
    var id = $("#upgradelog_id").val();
    var status = $("input[name='status']:checked").val();
    var reasons_pass = $("input[name='reasons_pass']").val();
    if (status==2&&reasons_pass=="") {
      _alert('请输入不通过理由',true);
      return false;
    }
    var arr = new Object();
    arr.id=id;
    arr.status=status;
    arr.reasons_pass=reasons_pass;
    var res = jq_ajax('{:url("check")}', arr);
    if(res.code==0){
      return false;
    }
    _alert('操作成功',true,'{:url("index")}');
  });

  // 选择是否通过
  function changeStatusValue(type){
    $("input[name='reasons_pass']").val('');
    if (type==2) {
      $("#reasons_pass").show();
    } else{
      $("#reasons_pass").hide();
    }
  }
</script>
{/block}
